package com.song.controller;

import com.github.tobato.fastdfs.domain.fdfs.StorePath;
import com.song.util.FastDfsUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = {"文件管理"})
@RestController
public class FastDfsController {
    @Autowired
    private FastDfsUtil fastDfsUtil;

    @PostMapping("/upload")
    @ApiOperation(value = "上传文件", notes = "上传文件")
    public String upload(MultipartFile file){
        StorePath storePath = fastDfsUtil.upload(file);
        return storePath.getFullPath();
    }
}
